/**
 * 
 */
package Singleton;

/**
 * @author sz
 *
 * create time锛�012-8-3
 */
public class Client {

	public static void main(String[] args) {

		Singleton s1 = Singleton.getInstance();
		Singleton s2 = Singleton.getInstance();

		if (s1 == s2) {
			System.out.println("相等");
		} else {
			System.out.println("不相等");
		}

		//线程锁
		SingletonSync s3 = SingletonSync.getInstance();
		SingletonSync s4 = SingletonSync.getInstance();

		if (s3 == s4) {
			System.out.println("相等");
		}

		SingletonInner s5 = SingletonInner.getInstance();
		SingletonInner s6 = SingletonInner.getInstance();

		if (s5 == s6) {
			System.out.println("相等");
		}
		//		System.gc();
		//		int i =0;
		//		while(i<1000000000)
		//			;
		SingletonSyncLock s7 = SingletonSyncLock.getInstance();
		SingletonSyncLock s8 = SingletonSyncLock.getInstance();

		if (s5 == s6) {
			System.out.println("相等");
		}
	}

}
